: Gsyn.mod
: as described in $NEURONHOME/nrn/share/nrn/examples/nrniv/netcon/gsyn.mod

TITLE Two state kinetic scheme conductance

COMMENT
    Synaptic conductance is modeled as a two state kinetic scheme. 
    
      k1   k2
    C -> O -> bath

    C represents the channel in 'closed' state and O in 'open' state.
    The activation rate (k1) should be faster the decay rate (k2) 

    the time constants tau_on= 1/k1 and tau_off = 1/k2

        i = g * (v-e), 
    
    where i is current in nA, g is conductance in microhms, 
    v is membrane potential (in mV) and e is the reversal potential 
    of the synapse (in mV)

    the function is normalized to time of the peak, so that the gmax is the 
    peak of the conductance.

ENDCOMMENT

NEURON {
    POINT_PROCESS GSyn
    RANGE tau_on, tau_off
    RANGE e_rev, i
    NONSPECIFIC_CURRENT i
}

UNITS {
    (nA) = (nanoamp)
    (mV) = (millivolt)
    (umho) = (micromho)
}

PARAMETER {
    tau_on  = 0.2 (ms)
    tau_off = 2.5 (ms)
    e_rev   = 0.0 (mV)
}

ASSIGNED {
    i (nA)
    v (mV)
    g (umho)
}

STATE {
    C (umho)
    O (umho)
}

BREAKPOINT {
    SOLVE state METHOD cnexp
    g = O - C
    i = g*(v - e_rev)
}

DERIVATIVE state {
    C' = -C/tau_on
    O' = -O/tau_off
}

